const { contextBridge, ipcRenderer } = require('electron')
const os = require('os')

contextBridge.exposeInMainWorld('electronAPI', {
  // 平台信息
  platform: os.platform(),
  
  // 窗口控制
  minimizeWindow: () => ipcRenderer.invoke('window:minimize'),
  maximizeWindow: () => ipcRenderer.invoke('window:maximize'),
  closeWindow: () => ipcRenderer.invoke('window:close'),
  startDrag: () => ipcRenderer.invoke('window:drag'),
  
  // 文件操作
  openFileDialog: () => ipcRenderer.invoke('dialog:openFile'),
  showItemInFolder: (filePath) => ipcRenderer.invoke('file:showInFolder', filePath),
  
  // 打印功能
  getPrinters: () => ipcRenderer.invoke('printer:getPrinters'),
  printFile: (options) => ipcRenderer.invoke('printer:printFile', options),
  batchPrint: (options) => ipcRenderer.invoke('printer:batchPrint', options),
  testPrinter: (printerName) => ipcRenderer.invoke('printer:testPrinter', printerName),
  getSystemInfo: () => ipcRenderer.invoke('printer:getSystemInfo')
})